#include "apue.h"
int main(int count, char **files) {
	for (int i = 1; i < count; i++) {
		struct stat buf;
		printf("%s: ", files[i]);
		if (lstat(files[i], &buf) < 0) {
			err_sys("lstat error");
		}
		if (S_ISREG(buf.st_mode)) {
			printf ("REG\n");
		} else if (S_ISDIR(buf.st_mode)) {
			printf("DIR\n");
		} else {
			printf("other mode\n");
		}
	}
	return 0;
}

